home *** CD-ROM | disk | FTP | other *** search
/ Developer Source 18 / Developer Source Volume 18 (I-MODE Publications, Inc.)(2000).iso / visua / feb98 / swanf103.gif < prev    next >
Graphics Interchange Format  |  1998-06-08  |  33KB  |  623x485  |  4-bit (4 colors)
Labels: text | screenshot | font | number | black and white | parallel | document
OCR: Method Description void oddNotify As with similarly nomed methods scattered throughout the AWT package, this method attaches a Menultem object to the operating system's native peer. It is through this attachment that the menu takes on its local characteristics, but there is rarely any reason for an application to call this method. String getLabel Returns the Menultem's current label, which is the text displayed in the item and used to construct the object. void setLabel(String label) Changes the Menultem's current label. This method is highly useful for creating dynamic menus that change according to other activities. For example, an Open com- mand might be changed to Close - a neat ond simple way to restrict users to open- ing one file at a time. booleon isEnabled Returns true if this menu item is enabled. Users con select only enabled menu items. Rather than maintain separate boolean flag variables for individual menu items, you might enable and disable the menu items, and call isEnabled to check their current states. In this way, the menu items themselves serve as their own on-and-off flags. void enable Enables this menu item. This method is highly useful for creating dynamic menus that disable and enable selected menu items according to other activities. For example, a menu item named Save might be enabled only if a change is made to a document. Newly created Menuitem objects are enabled by default. void enable(boolean cond) Changes the current enable-state of a Menultem object. This is useful in programs that keep boolean flags that indicate whether a specific Menultem should be enabled. Rather than test that flag using an if statement, then calling enable or disable, you can more simply pass the flag to this overloaded form of the enable method. void disable Disables this menu item, preventing its selection. Calling this method causes the menu item to be displayed in dim or mottled text that indicates it cannot currently be selected. The exact look depends on the operating system.) String paramString Returns the current text of the Menuitem object in the form Label=label. This method is used primarily for debugging, often by way of the MenuComponent.toString method. To obtain only the text of the Menuliem object, call getLabel instead of paromString. (I sus- pect this method was declared public by mistake, because there is little reason for on application to call it.) Figure 3: The public methods of the Monultem class.